import {MD5} from '~/utils/md5'
export default function ({ $axios, redirect }) {
  $axios.onRequest(config => {
    console.log('Making request to ' + config.url)
    console.log('data',config.data)

    let data=config.data;
    data.time=new Date().getTime()
    data.sign=MD5(data);
    config.data=data;
    return config;
  },
  )

  $axios.onError(error => {
    const code = parseInt(error.response && error.response.status)
    if (code === 400) {
      redirect('/400')
    }
  })
}
